/**
 * Created by wlc on 2018/4/19.
 */
$(document).ready(function(){
    //设置昵称悬停和焦点样式
    $("#register-nickname").focusout(function(){
        $("#register-nickname").css("background-color","white");
        $("#register-nickname-icon").css("color","#c8c8c8");
    });
    $("#register-nickname").hover(function(){
        $("#register-nickname").css("background-color","beige");
        $("#register-nickname-icon").css("color","#45D0E7");
    },function(){
        if (!$("#register-nickname").is(":focus")){
            $("#register-nickname").css("background-color","white");
            $("#register-nickname-icon").css("color","#c8c8c8");
        }
    });
    //设置邮箱悬停和焦点样式
    $("#register-email").focusout(function(){
        $("#register-email").css("background-color","white");
        $("#register-email-icon").css("color","#c8c8c8");
    });
    $("#register-email").hover(function(){
        $("#register-email").css("background-color","beige");
        $("#register-email-icon").css("color","#45D0E7");
    },function(){
        if (!$("#register-email").is(":focus")){
            $("#register-email").css("background-color","white");
            $("#register-email-icon").css("color","#c8c8c8");
        }
    });

    //设置密码悬停和焦点样式
    $("#register-password").focusout(function(){
        $("#register-password").css("background-color","white");
        $("#register-password-icon").css("color","#c8c8c8");
    });
    $("#register-password").hover(function(){
        $("#register-password").css("background-color","beige");
        $("#register-password-icon").css("color","#45D0E7");
    },function(){
        if (!$("#register-password").is(":focus")){
            $("#register-password").css("background-color","white");
            $("#register-password-icon").css("color","#c8c8c8");
        }
    });

    //设置验证码悬停和焦点样式
    $("#register-verification").focusout(function(){
        $("#register-verification").css("background-color","white");
    });
    $("#register-verification").hover(function(){
        $("#register-verification").css("background-color","beige");
    },function(){
        if (!$("#register-verification").is(":focus")){
            $("#register-verification").css("background-color","white");
        }
    });

    //设置密码可见和不可见样式
    $("#register-password-icon").click(function () {
        if($("#register-password-icon")[0].className === "fa fa-lock fa-fw"){
            $("#register-password-icon")[0].className = "fa fa-unlock fa-fw";
            $("#register-password")[0].type="text";
        }else {
            $("#register-password-icon")[0].className = "fa fa-lock fa-fw";
            $("#register-password")[0].type="password";
        }
    })
});